﻿using Pay.Data;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Pay.Data.Mapping.Token
{
    public partial class RedRecordMap : EntityTypeConfiguration<RedRecord>
    {

        public RedRecordMap()
        {
            ToTable("mc_RedRecord", "dbo");
            HasKey(t => t.Id);
            Property(t => t.Id)
                .HasColumnName("Id")
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.MerchantId)
                .HasColumnName("MerchantId")
                .IsRequired();
            Property(t => t.TotalHorsePower)
               .HasColumnName("TotalHorsePower")
               .IsRequired();
            Property(t => t.TotalRedDrill)
              .HasColumnName("TotalRedDrill").HasPrecision(18,6)
              .IsRequired();
            Property(t => t.FrozenRedDrill)
              .HasColumnName("FrozenRedDrill").HasPrecision(18, 6)
             .IsRequired();
            Property(t => t.InvitationCode)
               .HasColumnName("InvitationCode")
               .HasMaxLength(20)
               .IsRequired();
            Property(t => t.DayRedDrill)
                .HasColumnName("DayRedDrill")
               .HasMaxLength(1000)
               .IsRequired();
            Property(t => t.CreateTime)
              .HasColumnName("CreateTime")
              .IsRequired();
            Property(t => t.RegisterTime)
              .HasColumnName("RegisterTime")
              .IsRequired();
            Property(t => t.NextProductionTime)
              .HasColumnName("NextProductionTime")
             .IsRequired();
            Property(t => t.InvitationCodeNum)
            .HasColumnName("InvitationCodeNum")
           .IsRequired();
            Property(t => t.IsFinish)
           .HasColumnName("IsFinish")
          .IsRequired();
            Property(t => t.ConsumeRedDrill)
           .HasColumnName("ConsumeRedDrill").HasPrecision(18, 6)
         .IsRequired();
            HasRequired(t => t.Merchant)
               .WithMany()
               .HasForeignKey(d => d.MerchantId)
               .WillCascadeOnDelete(false);
            Property(p => p.RowVersion).IsRowVersion();
        }
    }
}
